#include <iostream>
#include <vector>
using namespace std;

void Qsort(int* a, int* b, int n)
{
	vector<int> count(n);
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (a[i] <= a[j]) count[j]++;
			else count[i]++;
		}
	}
	for (int i = 0; i < n; i++) b[count[i]] = a[i];
}

int main()
{
	int a[10] = {3,4,1,6,8,9,5,2,7,0};
	int b[10];
	int s = sizeof(a) / sizeof(int);
	memset(b, 0, s);
	Qsort(a,b,s);
	for (auto k : b)
		cout << k << " ";
	return 0;
}